<?php

class GaAPI_Autoloader {

    public function load($class) {
        if (!class_exists($class, false)) {
            $name = str_replace('GaAPI_', '', $class);
            $path = str_replace('_', '/', $name) . '.php';
            $fullpath = GAAPI_LIB_PATH . $path;
            require $fullpath;
        }
    }

    /**
     * Singleton
     * @return GaAPI_Autoloader
     */
    static public function instance() {
        static $instance;
        if (!($instance instanceof self)) {
            $instance = new self();
        }
        return $instance;
    }
}